from selenium.webdriver.common.by import By
from pages.pages_two.base_page import BasePage

class LoginPage(BasePage):
    # 定位器
    url = "/crm"
    username_locator = (By.NAME, 'name')
    password_locator = (By.NAME, 'password')
    btn_login_locator = (By.NAME, 'submit')

    # 操作
    def input_username(self, username):
        """输入用户名"""
        self.find_element(self.username_locator).send_keys(username)
        # self.driver.find_element(*self.username_locator).send_keys(username)

    def input_password(self, password):
        """输入密码"""
        self.find_element(self.password_locator).send_keys(password)
        # self.driver.find_element(*self.password_locator).send_keys(password)

    def click_btn_login(self):
        """点击登录按钮"""
        self.find_element(self.btn_login_locator).click()
        # self.driver.find_element(*self.btn_login_locator).click()
